
package tomkitty.util;

import tomkitty.server.*;
import tomkitty.turdlet.*;
import java.util.Vector;
import java.util.Iterator;

/**
 * EventListenerCollection is a class to hold a bunch of EventListeners and
 * make it convenient to fire off Events for all registered ones at once.
 *
 * @author micha
 *
 */
public class EventListenerCollection<E> extends Vector<E> {

	/**
	 *
	 * Sends the event to all registered listeners by executing the
	 * onEvent() method of each one.
	 *
	 * @param event the Event object to send to the listeners.
	 */
	public void fireEvent(Event event) {
		for (Iterator it = iterator(); it.hasNext();) {
			EventListener l = (EventListener) it.next();
			l.onEvent(event);
		}
	}

}
